function [output] = a_9_getNumericVariableFromTable(Minput, entityIdVarName, entityLabels, varName)
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	% This function takes as input a table where one column contains an id called entityIdVarName (not necessarily sorted in the right order),
	% and another column is a numerical variable called varName.
	% The ids are assumed to be unique.
	% We have all the ids in entityLabels sorted in the right order.
	% The function returns the corresponding numerical variable corresponding to each entity (in the right order).
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Inputs:
	% Minput:               table with at least two columns named entityIdVarName and varName
	% entityIdVarName:      string (e.g. 'CarId', 'UserId', ...)
	% entityLabels:         (=carLabels,...)
	% varName:              string (e.g. 'creationDate_julian')
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	%%%%% Outputs:
	% 
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
    NumEntities = length(entityLabels);
	output      = zeros(NumEntities,1);
	entityIds   = table2array(Minput(:,entityIdVarName));
	[~,entityIdxes] = ismember(entityIds, entityLabels);
	output(entityIdxes) = table2array(Minput(:, varName));
end
